package ken.spring.cloud.alibaba;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * <ul>
 * <li>Title: NacosProviderApplication</li>
 * <li>Description: TODO </li>
 * </ul>
 *
 * @author swc
 * @date 2022-06-20 20:40
 */
@SpringBootApplication
@EnableDiscoveryClient
//@EnableCircuitBreaker//支持断路器
public class NacosProviderApplication {

    public static void main(String[] args) {
        SpringApplication.run(NacosProviderApplication.class, args);
    }

    @RestController
    public class EchoController {
        @GetMapping(value = "/echo/{string}")
        public String echo(@PathVariable String string) {
            try {
                Thread.sleep(300);
            } catch (Exception e) {
                e.printStackTrace();
            }
           /* int a=1,b=0;
            int c =a /b;*/
            return "Hello Nacos Discovery" + string;
        }
    }
}
